package com.sky.mapper;

import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * TODO
 *
 * @Author mr.zhang
 * Date 2025/6/3 21:39
 */
@Mapper
public interface OrderDetailMapper {
    /**
     * 批量添加订单明细
     * @param orderDetailList
     */
    void batchInsert(List<OrderDetail> orderDetailList);

    /**
     * 根据用户id获取订单详情
     *
     * @param
     * @param id
     * @return
     */
    @Select("  select * from order_detail where order_id = #{orderId}")
    List<OrderDetail> selectByOrderId(@Param("orderId") Long orderId);

    /**
     * 根据订单id查询订单详情数据
     * @param id
     * @return
     */
    @Select("select * from order_detail where order_id=#{orderId}")
    List<OrderDetail> getByOrderId(@Param("orderId") Long id);

    /**
     * 根据订单id批量删除
     * @param id
     */
    void batchDelete(@Param("orderId") Long id);
}
